#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    int* arr = new int[n];
    for (int j = 0; j < n; j++)
    {
        scanf("%d", &arr[j]);
    }
    int* price = new int[2] {0, 0};
    if (arr[1] > arr[2])
    {
        price[0] += arr[2];
        for (int i = 3; i < n - 1;)
        {
            if (arr[i] > arr[i + 1])
            {
                price[0] += arr[i + 1];
                i += 2;
            }
            else {
                price[0] += arr[i];
                i++;
            }

        }
        cout << price[0];
    }
    else {
        price[1] += arr[1];
        for (int i = 2; i < n - 1;)
        {
            if (arr[i] > arr[i + 1])
            {
                price[1] += arr[i + 1];
                i += 2;
            }
            else {
                price[1] += arr[i];
                i++;
            }

        }
        cout << price[1];
    }
}
#include <iostream>
using namespace std;

int main() {
    float a;
    char b;
    int price;
    int weight;
    cin >> a >> b;
    if (b == 'y')
    {
        if (a <= 1)
            price = 20;
        else
        {
            weight = a / 1;
            price = 20 + (weight - 1);
            if (a > weight)
                price += 1;
        };
        cout << 5 + price;
    }
    else {
        if (a <= 1)
            price = 20;
        else
        {
            weight = a / 1;
            price = 20 + (weight - 1);
            if (a > weight)
                price += 1;
        };
        cout << price;
    }
}
